package com.winning.yanghao.designpattern.factory.simple;

import com.winning.yanghao.designpattern.factory.AppleComputer;
import com.winning.yanghao.designpattern.factory.Computer;
import com.winning.yanghao.designpattern.factory.DellComputer;
import com.winning.yanghao.designpattern.factory.LenovoComputer;

public class ComputerFactory {

    public Computer getComputer(String name){
        if("Apple".equalsIgnoreCase(name)){
            return new AppleComputer();
        }else if("Dell".equalsIgnoreCase(name)){
            return new DellComputer();
        }else if("Lenovo".equalsIgnoreCase(name)){
            return new LenovoComputer();
        }else{
            System.out.println("电脑名称有误！");
            return null;
        }
    }

}
